<template>
  
  <div  style="width: 100%;height: 40px;background-color: rgb(42, 178, 139);margin-top: 20px;display: flex;margin-top:100px;">
    <!-- <div  style="width: 100%;height: 40px;background-color: rgb(42, 178, 139);margin-top: 20px;display: flex;page-break-before:always;"> -->
    <div><img src="../../assets/img/15.jpg" style="height: 40px" alt="" /></div>
    <div style="font-size: 20px;margin-left: 10px;line-height: 40px;color:#fff;">
      膳食评价(日均值)
    </div>
  </div>
  <div style="width:98% ;border:2px solid #09a578;text-align:center;margin-top:10px;">
    <div style="display:flex">
      <div class="biao1" style="width:25%;height:40px;line-height:40px">元素</div>
      <div class="biao1" style="width:25%;height:40px;line-height:40px">状态</div>
      <div class="biao1" style="width:25%;height:40px;line-height:40px">分析值</div>
      <div class="biao3" style="width:25%;height:40px;line-height:40px">参考范围</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">能量</div>
      <div class="biao2" :class="[letEnergy.color]" style="width:25%;height:40px;line-height:40px">{{ letEnergy.keyword }}</div>
      <div class="biao2" :class="[letEnergy.color]" style="width:25%;height:40px;line-height:40px">{{  letEnergy.energy }}kcal</div>
      <div class="biao2" :class="[letEnergy.color]" style="width:25%;height:40px;line-height:40px">{{  letEnergy.start }}～{{ letEnergy.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">蛋白质</div>
      <div class="biao2" :class="[protein.color]" style="width:25%;height:40px;line-height:40px">{{ protein.keyword }}</div>
      <div class="biao2" :class="[protein.color]" style="width:25%;height:40px;line-height:40px">{{  protein.energy }}g</div>
      <div class="biao2" :class="[protein.color]" style="width:25%;height:40px;line-height:40px">{{  protein.start }}～{{ protein.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">脂肪</div>
      <div class="biao2" :class="[fat.color]"  style="width:25%;height:40px;line-height:40px">{{ fat.keyword }}</div>
      <div class="biao2" :class="[fat.color]"  style="width:25%;height:40px;line-height:40px">{{  fat.energy }}g</div>
      <div class="biao2" :class="[fat.color]"  style="width:25%;height:40px;line-height:40px">{{  fat.start }}～{{ fat.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">碳水化合物</div>
      <div class="biao2" :class="[carbohydrate.color]" style="width:25%;height:40px;line-height:40px">{{ carbohydrate.keyword }}</div>
      <div class="biao2" :class="[carbohydrate.color]" style="width:25%;height:40px;line-height:40px">{{  carbohydrate.energy }}g</div>
      <div class="biao2" :class="[carbohydrate.color]" style="width:25%;height:40px;line-height:40px">{{  carbohydrate.start }}～{{ carbohydrate.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">钙</div>
      <div class="biao2" :class="[calcium.color]" style="width:25%;height:40px;line-height:40px">{{ calcium.keyword }}</div>
      <div class="biao2" :class="[calcium.color]" style="width:25%;height:40px;line-height:40px">{{  calcium.energy }}mg</div>
      <div class="biao2" :class="[calcium.color]" style="width:25%;height:40px;line-height:40px">{{  calcium.start }}～{{ calcium.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">钠</div>
      <div class="biao2" :class="[sodium.color]" style="width:25%;height:40px;line-height:40px">{{ sodium.keyword }}</div>
      <div class="biao2" :class="[sodium.color]" style="width:25%;height:40px;line-height:40px">{{  sodium.energy }}mg</div>
      <div class="biao2" :class="[sodium.color]" style="width:25%;height:40px;line-height:40px">{{  sodium.start }}～{{ sodium.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">镁</div>
      <div class="biao2" :class="[magnesium.color]" style="width:25%;height:40px;line-height:40px">{{ magnesium.keyword }}</div>
      <div class="biao2" :class="[magnesium.color]" style="width:25%;height:40px;line-height:40px">{{  magnesium.energy }}mg</div>
      <div class="biao2" :class="[magnesium.color]" style="width:25%;height:40px;line-height:40px">{{  magnesium.start }}～{{ magnesium.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">铁</div>
      <div class="biao2" :class="[iron.color]" style="width:25%;height:40px;line-height:40px">{{ iron.keyword }}</div>
      <div class="biao2" :class="[iron.color]" style="width:25%;height:40px;line-height:40px">{{  iron.energy }}mg</div>
      <div class="biao2" :class="[iron.color]" style="width:25%;height:40px;line-height:40px">{{  iron.start }}～{{ iron.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">锌</div>
      <div class="biao2" :class="[zinc.color]"  style="width:25%;height:40px;line-height:40px">{{ zinc.keyword }}</div>
      <div class="biao2" :class="[zinc.color]" style="width:25%;height:40px;line-height:40px">{{  zinc.energy }}mg</div>
      <div class="biao2" :class="[zinc.color]"  style="width:25%;height:40px;line-height:40px">{{  zinc.start }}～{{ zinc.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">硒</div>
      <div class="biao2" :class="[selenium.color]"  style="width:25%;height:40px;line-height:40px">{{ selenium.keyword }}</div>
      <div class="biao2" :class="[selenium.color]"  style="width:25%;height:40px;line-height:40px">{{  selenium.energy }}mg</div>
      <div class="biao2" :class="[selenium.color]"  style="width:25%;height:40px;line-height:40px">{{  selenium.start }}～{{ selenium.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">维生素A</div>
      <div class="biao2" :class="[vitamin_a.color]" style="width:25%;height:40px;line-height:40px">{{ vitamin_a.keyword }}</div>
      <div class="biao2" :class="[vitamin_a.color]" style="width:25%;height:40px;line-height:40px">{{  vitamin_a.energy }}mg</div>
      <div class="biao2" :class="[vitamin_a.color]" style="width:25%;height:40px;line-height:40px">{{  vitamin_a.start }}～{{ vitamin_a.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">维生素E</div>
      <div class="biao2" :class="[vitamin_e.color]"  style="width:25%;height:40px;line-height:40px">{{ vitamin_e.keyword }}</div>
      <div class="biao2" :class="[vitamin_e.color]"  style="width:25%;height:40px;line-height:40px">{{  vitamin_e.energy }}mg</div>
      <div class="biao2" :class="[vitamin_e.color]"  style="width:25%;height:40px;line-height:40px">{{  vitamin_e.start }}～{{ vitamin_e.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">维生素B1</div>
      <div class="biao2" :class="[vitamin_b1.color]" style="width:25%;height:40px;line-height:40px">{{ vitamin_b1.keyword }}</div>
      <div class="biao2" :class="[vitamin_b1.color]" style="width:25%;height:40px;line-height:40px">{{  vitamin_b1.energy }}mg</div>
      <div class="biao2" :class="[vitamin_b1.color]" style="width:25%;height:40px;line-height:40px">{{  vitamin_b1.start }}～{{ vitamin_b1.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">维生素B2</div>
      <div class="biao2" :class="[vitamin_b2.color]" style="width:25%;height:40px;line-height:40px">{{ vitamin_b2.keyword }}</div>
      <div class="biao2" :class="[vitamin_b2.color]" style="width:25%;height:40px;line-height:40px">{{  vitamin_b2.energy }}mg</div>
      <div class="biao2" :class="[vitamin_b2.color]" style="width:25%;height:40px;line-height:40px">{{  vitamin_b2.start }}～{{ vitamin_b2.end }}</div>
    </div>
    <div style="display:flex;">
      <div class="biao2" style="width:25%;height:40px;line-height:40px">维生素C</div>
      <div class="biao2" :class="[vitamin_c.color]"  style="width:25%;height:40px;line-height:40px">{{ vitamin_c.keyword }}</div>
      <div class="biao2" :class="[vitamin_c.color]"  style="width:25%;height:40px;line-height:40px">{{  vitamin_c.energy }}mg</div>
      <div class="biao2" :class="[vitamin_c.color]"  style="width:25%;height:40px;line-height:40px">{{  vitamin_c.start }}～{{ vitamin_c.end }}</div>
    </div>
    </div>
    
</template>

<script setup>
import {defineComponent, onMounted, ref, watch} from 'vue';
import {ElMessage} from "element-plus";
import * as api from "../../api/loginHttp";
import http, {baseUrl} from "../../utils/http";
import {useRoute, useRouter} from "vue-router"


const router = useRouter()
const route = useRoute()
const labName = ref()
const groupId = ref()
const reportId = ref()
const id = ref()
const username = ref()
const guardian = ref()
const birth = ref()
const imgUrl = ref()

const letEnergy = ref({'energy': 0, 'start':0, 'end':0})
const protein = ref({'energy': 0, 'start':0, 'end':0})
const fat = ref({'energy': 0, 'start':0, 'end':0})
const carbohydrate= ref({'energy': 0, 'start':0, 'end':0})
const calcium = ref({'energy': 0, 'start':0, 'end':0})
const sodium = ref({'energy': 0, 'start':0, 'end':0})
const magnesium = ref({'energy': 0, 'start':0, 'end':0})
const iron = ref({'energy': 0, 'start':0, 'end':0})
const zinc = ref({'energy': 0, 'start':0, 'end':0})
const selenium = ref({'energy': 0, 'start':0, 'end':0})
const vitamin_a =ref({'energy': 0, 'start':0, 'end':0})
const vitamin_e = ref({'energy': 0, 'start':0, 'end':0})
const vitamin_b1 = ref({'energy': 0, 'start':0, 'end':0})
const vitamin_b2 = ref({'energy': 0, 'start':0, 'end':0})
const vitamin_c =ref({'energy': 0, 'start':0, 'end':0})
const diet_analysis = ref({})

const onHome = async () => {
  await router.push({'path': '/Home'})
}
const kcalType = ref(2)

const fetchData = async () => {
  if (route.params.groupId) {
    groupId.value = route.params.groupId
    id.value = route.params.id
    reportId.value = route.params.reportId

    username.value = route.params.username
    guardian.value = route.params.guardian
    birth.value = route.params.birth
    if (groupId.value === 3) {
      labName.value = '婴幼儿营养测评'
    } else if (groupId.value === 5) {
      labName.value = '孕产妇营养测评'
    } else if (groupId.value === 6) {
      labName.value = '成年人营养测评'
    } else if (groupId.value === 7) {
      labName.value = '慢性病营养测评'
    } else {
      labName.value = '婴幼儿营养测评'
    }

    imgUrl.value = "http://"+baseUrl+'/';

    let params = {
      'groupId': groupId.value,
      'id': id.value,
      'reportId': reportId.value,
      'username': username.value,
      'guardian': guardian.value,
      'birth': birth.value,
    }
    const data = await api.energy(params);

    if(data.data.code == 0) {
      ElMessage.error(data.data.msg)
      return false;
      await router.push({'path':'/Evaluation/' + groupId.value +'/'+ id})
    }

    if(!data.data.data.diet_analysis) {
      ElMessage.error(data.data.msg)
      return false;
      await router.push({'path':'/Evaluation/' + groupId.value +'/'+ id})
    }
    for(let i = 0; i< data.data.data.diet_analysis.length; i++) {
      switch (i){
        case 0:
          data.data.data.diet_analysis[i]['pName'] = '周一';
          break
        case 1:
          data.data.data.diet_analysis[i]['pName'] = '周二';
          break
        case 2:
          data.data.data.diet_analysis[i]['pName'] = '周三';
          break
        case 3:
          data.data.data.diet_analysis[i]['pName'] = '周四';
          break
        case 4:
          data.data.data.diet_analysis[i]['pName'] = '周五';
          break
        case 5:
          data.data.data.diet_analysis[i]['pName'] = '周六';
          break
        case 6:
          data.data.data.diet_analysis[i]['pName'] = '周日';
          break
      }
    }


    diet_analysis.value = data.data.data.diet_analysis;

    for(let i = 0; i< data.data.data.diet.length; i++) {

      if(parseInt(data.data.data.diet[i]['energy']) !== parseInt(data.data.data.diet[i]['energy'])){
        data.data.data.diet[i]['energy'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['protein']) !== parseInt(data.data.data.diet[i]['protein'])){
        data.data.data.diet[i]['protein'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['fat']) !== parseInt(data.data.data.diet[i]['fat'])){
        data.data.data.diet[i]['fat'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['carbohydrate']) !== parseInt(data.data.data.diet[i]['carbohydrate'])){
        data.data.data.diet[i]['carbohydrate'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['calcium']) !== parseInt(data.data.data.diet[i]['calcium'])){
        data.data.data.diet[i]['calcium'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['sodium']) !== parseInt(data.data.data.diet[i]['sodium'])){
        data.data.data.diet[i]['sodium'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['magnesium']) !== parseInt(data.data.data.diet[i]['magnesium'])){
        data.data.data.diet[i]['magnesium'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['iron']) !== parseInt(data.data.data.diet[i]['iron'])){
        data.data.data.diet[i]['iron'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['zinc']) !== parseInt(data.data.data.diet[i]['zinc'])){
        data.data.data.diet[i]['zinc'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['selenium']) !== parseInt(data.data.data.diet[i]['selenium'])){
        data.data.data.diet[i]['selenium'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['vitamin_a']) !== parseInt(data.data.data.diet[i]['vitamin_a'])){
        data.data.data.diet[i]['vitamin_a'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['vitamin_e']) !== parseInt(data.data.data.diet[i]['vitamin_e'])){
        data.data.data.diet[i]['vitamin_e'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['vitamin_b1']) !== parseInt(data.data.data.diet[i]['vitamin_b1'])){
        data.data.data.diet[i]['vitamin_b1'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['vitamin_b2']) !== parseInt(data.data.data.diet[i]['vitamin_b2'])){
        data.data.data.diet[i]['vitamin_b2'] = 0;
      }
      if(parseInt(data.data.data.diet[i]['vitamin_c']) !== parseInt(data.data.data.diet[i]['vitamin_c'])){
        data.data.data.diet[i]['vitamin_c'] = 0;
      }
      letEnergy._value.energy = letEnergy._value.energy + parseInt(data.data.data.diet[i]['energy']);
      protein._value.energy = protein._value.energy + parseInt(data.data.data.diet[i]['protein']);
      fat._value.energy = fat._value.energy + parseInt(data.data.data.diet[i]['fat']);
      carbohydrate._value.energy = carbohydrate._value.energy + parseInt(data.data.data.diet[i]['carbohydrate']);
      calcium._value.energy = calcium._value.energy + parseInt(data.data.data.diet[i]['calcium']);
      sodium._value.energy = sodium._value.energy + parseInt(data.data.data.diet[i]['sodium']);
      magnesium._value.energy = magnesium._value.energy + parseInt(data.data.data.diet[i]['magnesium']);
      iron._value.energy = iron._value.energy + parseInt(data.data.data.diet[i]['iron']);
      zinc._value.energy = zinc._value.energy + parseInt(data.data.data.diet[i]['zinc']);
      selenium._value.energy = selenium._value.energy + parseInt(data.data.data.diet[i]['selenium']);
      vitamin_a._value.energy = vitamin_a._value.energy + parseInt(data.data.data.diet[i]['vitamin_a']);
      vitamin_e._value.energy = vitamin_e._value.energy + parseInt(data.data.data.diet[i]['vitamin_e']);
      vitamin_b1._value.energy = vitamin_b1._value.energy + parseInt(data.data.data.diet[i]['vitamin_b1']);
      vitamin_b2._value.energy = vitamin_b2._value.energy + parseInt(data.data.data.diet[i]['vitamin_b2']);
      vitamin_c._value.energy = vitamin_c._value.energy + parseInt(data.data.data.diet[i]['vitamin_c']);
    }



    letEnergy._value.start = data.data.data.packAge[0].start_package;
    letEnergy._value.end = data.data.data.packAge[0].end_package;
    letEnergy._value.keyword = '✔ 正常';
    letEnergy._value.color = 'everyBlack';

    if ( letEnergy._value.energy < letEnergy._value.start) {
      letEnergy._value.keyword = '▼ 不足';
      letEnergy._value.color = 'everyRed';
      kcalType.value = 3
    } else if( letEnergy._value.energy > letEnergy._value.end) {
      letEnergy._value.keyword = '▲ 超标';
      letEnergy._value.color = 'everyOrange';
      kcalType.value = 1
    }


    protein._value.start = data.data.data.packAge[1].start_package;
    protein._value.end = data.data.data.packAge[1].end_package;
    protein._value.keyword = '✔ 正常';
    protein._value.color = 'everyBlack';
    if ( protein._value.energy < protein._value.start) {
      protein._value.keyword = '▼ 不足';
      protein._value.color = 'everyRed';
    } else if( protein._value.energy > protein._value.end) {
      protein._value.keyword = '▲ 超标';
      protein._value.color = 'everyOrange';
    }

    fat._value.start = data.data.data.packAge[2].start_package;
    fat._value.end = data.data.data.packAge[2].end_package;
    fat._value.keyword = '✔ 正常';
    fat._value.color = 'everyBlack';
    if ( fat._value.energy < fat._value.start) {
      fat._value.keyword = '▼ 不足';
      fat._value.color = 'everyRed';
    } else if( fat._value.energy > fat._value.end) {
      fat._value.keyword = '▲ 超标';
      fat._value.color = 'everyOrange';
    }

    carbohydrate._value.start = data.data.data.packAge[3].start_package;
    carbohydrate._value.end = data.data.data.packAge[3].end_package;
    carbohydrate._value.keyword = '✔ 正常';
    carbohydrate._value.color = 'everyBlack';
    if ( carbohydrate._value.energy < carbohydrate._value.start) {
      carbohydrate._value.keyword = '▼ 不足';
      carbohydrate._value.color = 'everyRed';
    } else if( carbohydrate._value.energy > carbohydrate._value.end) {
      carbohydrate._value.keyword = '▲ 超标';
      carbohydrate._value.color = 'everyOrange';
    }

    calcium._value.start = data.data.data.packAge[4].start_package;
    calcium._value.end = data.data.data.packAge[4].end_package;
    calcium._value.keyword = '✔ 正常';
    calcium._value.color = 'everyBlack';
    if ( calcium._value.energy < calcium._value.start) {
      calcium._value.keyword = '▼ 不足';
      calcium._value.color = 'everyRed';
    } else if( calcium._value.energy > calcium._value.end) {
      calcium._value.keyword = '▲ 超标';
      calcium._value.color = 'everyOrange';
    }

    sodium._value.start = data.data.data.packAge[5].start_package;
    sodium._value.end = data.data.data.packAge[5].end_package;
    sodium._value.keyword = '✔ 正常';
    sodium._value.color = 'everyBlack';
    if ( sodium._value.energy < sodium._value.start) {
      sodium._value.keyword = '▼ 不足';
      sodium._value.color = 'everyRed';
    } else if( sodium._value.energy > sodium._value.end) {
      sodium._value.keyword = '▲ 超标';
      sodium._value.color = 'everyOrange';
    }

    magnesium._value.start = data.data.data.packAge[6].start_package;
    magnesium._value.end = data.data.data.packAge[6].end_package;
    magnesium._value.keyword = '✔ 正常';
    magnesium._value.color = 'everyBlack';
    if ( magnesium._value.energy < magnesium._value.start) {
      magnesium._value.keyword = '▼ 不足';
      magnesium._value.color = 'everyRed';
    } else if( magnesium._value.energy > magnesium._value.end) {
      magnesium._value.keyword = '▲ 超标';
      magnesium._value.color = 'everyOrange';
    }

    iron._value.start = data.data.data.packAge[7].start_package;
    iron._value.end = data.data.data.packAge[7].end_package;
    iron._value.keyword = '✔ 正常';
    iron._value.color = 'everyBlack';
    if ( iron._value.energy < iron._value.start) {
      iron._value.keyword = '▼ 不足';
      iron._value.color = 'everyRed';
    } else if( iron._value.energy > iron._value.end) {
      iron._value.keyword = '▲ 超标';
      iron._value.color = 'everyOrange';
    }

    zinc._value.start = data.data.data.packAge[8].start_package;
    zinc._value.end = data.data.data.packAge[8].end_package;
    zinc._value.keyword = '✔ 正常';
    zinc._value.color = 'everyBlack';
    if ( zinc._value.energy < zinc._value.start) {
      zinc._value.keyword = '▼ 不足';
      zinc._value.color = 'everyRed';
    } else if( zinc._value.energy > zinc._value.end) {
      zinc._value.keyword = '▲ 超标';
      zinc._value.color = 'everyOrange';
    }

    selenium._value.start = data.data.data.packAge[9].start_package;
    selenium._value.end = data.data.data.packAge[9].end_package;
    selenium._value.keyword = '✔ 正常';
    selenium._value.color = 'everyBlack';
    if ( selenium._value.energy < selenium._value.start) {
      selenium._value.keyword = '▼ 不足';
      selenium._value.color = 'everyRed';
    } else if( selenium._value.energy > selenium._value.end) {
      selenium._value.keyword = '▲ 超标';
      selenium._value.color = 'everyOrange';
    }

    vitamin_a._value.start = data.data.data.packAge[10].start_package;
    vitamin_a._value.end = data.data.data.packAge[10].end_package;
    vitamin_a._value.keyword = '✔ 正常';
    vitamin_a._value.color = 'everyBlack';
    if ( vitamin_a._value.energy < vitamin_a._value.start) {
      vitamin_a._value.keyword = '▼ 不足';
      vitamin_a._value.color = 'everyRed';
    } else if( vitamin_a._value.energy > vitamin_a._value.end) {
      vitamin_a._value.keyword = '▲ 超标';
      vitamin_a._value.color = 'everyOrange';
    }

    vitamin_e._value.start = data.data.data.packAge[11].start_package;
    vitamin_e._value.end = data.data.data.packAge[11].end_package;
    vitamin_e._value.keyword = '✔ 正常';
    vitamin_e._value.color = 'everyBlack';
    if ( vitamin_e._value.energy < vitamin_e._value.start) {
      vitamin_e._value.keyword = '▼ 不足';
      vitamin_e._value.color = 'everyRed';
    } else if( vitamin_e._value.energy > vitamin_e._value.end) {
      vitamin_e._value.keyword = '▲ 超标';
      vitamin_e._value.color = 'everyOrange';
    }

    vitamin_b1._value.start = data.data.data.packAge[12].start_package;
    vitamin_b1._value.end = data.data.data.packAge[12].end_package;
    vitamin_b1._value.keyword = '✔ 正常';
    vitamin_b1._value.color = 'everyBlack';
    if ( vitamin_b1._value.energy < vitamin_b1._value.start) {
      vitamin_b1._value.keyword = '▼ 不足';
      vitamin_b1._value.color = 'everyRed';
    } else if( vitamin_b1._value.energy > vitamin_b1._value.end) {
      vitamin_b1._value.keyword = '▲ 超标';
      vitamin_b1._value.color = 'everyOrange';
    }

    vitamin_b2._value.start = data.data.data.packAge[13].start_package;
    vitamin_b2._value.end = data.data.data.packAge[13].end_package;
    vitamin_b2._value.keyword = '✔ 正常';
    vitamin_b2._value.color = 'everyBlack';
    if ( vitamin_b2._value.energy < vitamin_b2._value.start) {
      vitamin_b2._value.keyword = '▼ 不足';
      vitamin_b2._value.color = 'everyRed';
    } else if( vitamin_b2._value.energy > vitamin_b2._value.end) {
      vitamin_b2._value.keyword = '▲ 超标';
      vitamin_b2._value.color = 'everyOrange';
    }

    vitamin_c._value.start = data.data.data.packAge[14].start_package;
    vitamin_c._value.end = data.data.data.packAge[14].end_package;
    vitamin_c._value.keyword = '✔ 正常';
    vitamin_c._value.color = 'everyBlack';
    if ( vitamin_c._value.energy < vitamin_c._value.start) {
      vitamin_c._value.keyword = '▼ 不足';
      vitamin_c._value.color = 'everyRed';
    } else if( vitamin_c._value.energy > vitamin_c._value.end) {vitamin_c
      vitamin_c._value.keyword = '▲ 超标';
      vitamin_c._value.color = 'everyOrange';
    }

  } else {
    ElMessage.error('栏目编号不得为空')
    await router.push({'path': '/Home'})
  }
}
const pageList = async () => {
  await router.push({'path': '/pageList/' + groupId.value})
}
onMounted(() => {
  fetchData()
})
</script>

<style scoped>
.right-box-card {
  margin-left: 2%;
  margin-top: 1%;
  position: static;
  top: calc(260px);
  width: 60%;
  float: left;
  /*min-height: 650px;*/
}

.images-wrapper {
  width: 100%;
  position: relative;
  height: 173px;
  font-weight: bold;
}
.foodsNames {
  color:red;
}

.images-content {
  position: absolute;
  z-index: 1;
  line-height: 54px;
  top: calc(55% - 54px);
  overflow: hidden;
  margin-left: 55%;
  font-size: 18px;

}

.service_plate {
  background: url('../../assets/img/evaluaction_service_plate.png') center no-repeat;
}

.dietOn {
  height: 500px;
}

.everyRed {
  color:red;
}

.everyOrange {
  color:orange;
}

.everyBlack {
  color:#333333;
}

.time-botton {
  background-color: #2AB28B;
  width: 108px;
  height: 41px;
  color: #fff;
  font-size: 16px;
  border-radius: 100px;
  line-height: 41px;
  margin: 40px 0 0 40px;
  text-align: center;
}

.time-type {
  width: 58px;
  height: 58px;
  line-height: 58px;
  text-align: center;
  background: #85CE61;
  border-radius: 50%;
  opacity: 1;
  color: #fff;
  box-shadow: 5px 5px 2px #888888;
  margin: 20px 0 20px 40%;
}

.der{
  width: 354px;
  height: 241px;
  background: url("../../assets/img/evaluaction_service_plate.png") 100% 100%;
}

.platesFoods{
  margin-top: 5px;
  margin-left: 8px;

  color: #333333;
  font-size: 16px;
}
.platesFoods div {
  padding-bottom: 18px;

}
.platesFoods span{
  color: #666666;
}

.plates {
  width: 33%;
  float: left;
}

.plates .plates-top-img {
  float: left;
  margin-left: 1%;
}

.time-left-color {
  background: #85CE61;
}

.time-common-color {
  background: #E8B973;
}

.time-right-color {
  background: #6EA9E0;
}

.images-lab {
  position: absolute;
  z-index: 1;
  line-height: 54px;
  top: calc(85% - 54px);
  overflow: hidden;
  margin-left: 55%;
  font-size: 50px;
}

#params {
  margin-top: 3%;
  font-size: 22px;
  font-weight: bold;
}

.shu {
  width: 5px;
  height: 30px;
  background: #2AB28B;
  opacity: 1;
  border-radius: 100px;
  float: left;
  margin-right: 2%;
  margin-left: 3%;
}

#params span {
  font-size: 15px;
  color: #666;
  margin-left: 2%;
}

li {
  list-style-type: none;
}

#params ul {
  margin-left: 3%;
}

.topColor {
  color: #E8B973;
}

.topBgColor {
  border: 1px solid #E8B973;
  background-color: #E8B973;
}

.normalColor {
  color: #2AB28B;
}

.normalBgColor {
  border: 1px solid #2AB28B;
  background-color: #2AB28B;
}

.bottomColor {
  color: #6CA9E3;
}

.bottomBgColor {
  border: 1px solid #6CA9E3;
  background-color: #6CA9E3;
}

.images-lab span {
  font-size: 18px;
}

.images-right {
  position: absolute;
  z-index: 1;
  left: 0;
  bottom: 0;
  width: 15%;
  height: 20%;
  line-height: 34px;
  top: calc(95% - 54px);
  overflow: hidden;
  margin-left: 75%;
  font-size: 18px;
  border-radius: 30px;
  color: #fff;
  text-align: center;
}


#enerty .bt {
  background: #F7F7F7;
  color: #fff;
}

#enerty .bt span {
  width: 25%;
  float: left;
  text-align: center;
  color: #999999;
  line-height: 30px;
}

#enerty ul li {
  width: 48%;
  display: inline-block;
  margin: 0;
}

#enerty .element span {
  width: 25%;
  float: left;
  text-align: center;
  line-height: 50px;
}

.biao1{
  width:25%;border-bottom:1px solid rgb(9, 165, 120);border-right:1px solid rgb(9, 165, 120);background-color: rgb(42, 178, 139);color:#fff;
}
.biao3{
  width:25%;border-bottom:1px solid rgb(9, 165, 120);background-color: rgb(42, 178, 139);color:#fff;
}
.biao2{
  width:25%;border-bottom:1px solid rgb(9, 165, 120);border-right:1px solid rgb(9, 165, 120);
}
</style>
